home *** CD-ROM | disk | FTP | other *** search
- Path: erich.triumf.ca!bennett
- From: bennett@erich.triumf.ca (P.Bennett)
- Newsgroups: comp.lang.c
- Subject: Re: Help:what is wrong this code?
- Date: 5 Apr 1996 22:11 PST
- Organization: TRIUMF: Tri-University Meson Facility
- Distribution: world
- Message-ID: <5APR199622112909@erich.triumf.ca>
- References: <4k3p3q$n76@brahms.udel.edu>
- NNTP-Posting-Host: ftp.triumf.ca
- News-Software: VAX/VMS VNEWS 1.50
-
- In article <4k3p3q$n76@brahms.udel.edu>, yuehong@brahms.udel.edu (Yue-hong Zheng) writes...
- >
- >Why it give me 0.0000?
- >
- >#include <stdio.h>
- >main () {
- >double a=9.008;
- >printf("%f\n",sqrt(a));
- >return 0;
- >}
-
- Since sqrt() doesn't return an int, you have to make sure a prototype is in
- scope, by adding #include <math.h>.
-
-
-
- Peter Bennett VE7CEI | Vessels shall be deemed to be in sight
- Internet: bennett@triumf.ca | of one another only when one can be
- Packet: ve7cei@ve7kit.#vanc.bc.ca | observed visually from the other
- TRIUMF, Vancouver, B.C., Canada | ColRegs 3(k)
- GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
- or: ftp://ftp-i2.informatik.rwth-aachen.de/pub/arnd/GPS/peter/index.html
-
-